﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RoomPlayerItem : MonoBehaviour
{
    public Text m_NameL;
    public Text m_ReadyL;
    public Text m_NotReadyL;
    public PlayerNetwork m_Player;
    public RoomPlayersPanel m_Panel;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if(m_Player == null)
        {
            enabled = false;
            Destroy(gameObject);
            m_Panel.m_PlayerItems.Remove(this);
            return;
        }
        m_NameL.text = m_Player.m_PlayerName;
        if (m_Player.readyToBegin)
        {
            m_ReadyL.gameObject.SetActive(true);
            m_NotReadyL.gameObject.SetActive(false);
        }
        else
        {
            m_ReadyL.gameObject.SetActive(false);
            m_NotReadyL.gameObject.SetActive(true);
        }
    }
}
